/* Copyright (c) 2006 celumsolutions. All Rights Reserved. */
package at.rtm.tx.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.*;

/**
 * @author rudolf.traunmueller
 * @since 23.07.11
 */
public class SqlExecutor implements InitializingBean {

  DataSource dataSource;

  String sqlStatement;

  public String getSqlStatement() {
    return sqlStatement;
  }

  public void setSqlStatement(String sqlStatement) {
    this.sqlStatement = sqlStatement;
  }

  public DataSource getDataSource() {
    return dataSource;
  }

  public void setDataSource(DataSource dataSource) {
    this.dataSource = dataSource;
  }

  public void afterPropertiesSet() throws Exception {
    new JdbcTemplate(dataSource).execute(sqlStatement);
  }
}
